package com.scqzy.shengchunqiang.sword2offer.day22;

/**
 * @Description: 剑指 Offer 56 - II. 数组中数字出现的次数 II
 * @Author 盛春强
 * @Date 2021/8/29 23:15
 */
public class SingleNumber {
    public int singleNumber(int[] nums) {
        int a = 0;
        int b = 0;

        for(int num : nums) {
            a = (a ^ num) & ~b;
            b = (b ^ num) & ~a;
        }

        return a;
    }
}
